package controllers

import (
	"gitee.com/cjf8134/bbs_serve/internal/app/apiserve/services"
	"gitee.com/cjf8134/bbs_serve/internal/pkg/utils/responseutil"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

type TagController struct {
	logger  *zap.Logger
	service services.DefaultService
}

func NewTagController(logger *zap.Logger, s services.DefaultService) *TagController {
	return &TagController{
		logger:  logger.With(zap.String("type", "TagController")),
		service: s,
	}
}

// Tag list  列表
func (pc *TagController) List(c *gin.Context) {
	err := pc.service.TagList()
	if err != nil {
		pc.logger.Error("error", zap.Error(err))
		responseutil.FailJson(c, err.Error())
		return
	}
	responseutil.SusJson(c, "success")
}
